import { localFallbackRequestGet } from '@/utils/Request'

/**
 * 请求前缀，后面后台添加网关后需要前缀选择微服务
 */
const URL_PREFIX = 'middle-goods/'

/**
 * 根据父节点id获取子类节点列表
 * @param {Number, String} id 父节点id
 * @param {Boolean} refresh 是否刷新
 * @param {Function} successCallback 成功回调，参数为data
 * @param {Function} fullCallback 肯定触发的回调，先于callback
 */
export const queryChildrenByParentId = (id, refresh, successCallback = null, fullCallback = null) => {
  return localFallbackRequestGet(URL_PREFIX + 'sys_good_category/queryChildrenByParentId', { id }, {}, 24 * 60 * 60, refresh, true, data => {
    if (successCallback) {
      successCallback(data)
    }
  }, null, fullCallback)
}
